package com.yc.yyds.servlet;

import com.google.gson.Gson;
import com.yc.yyds.Bean.Result;
import com.yc.yyds.biz.BizException;
import com.yc.yyds.biz.QueryMovieBiz;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "tuijianServlet", value = "/tuijianServlet.s")
public class tuijianServlet extends HttpServlet {
    QueryMovieBiz biz =new QueryMovieBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {



        try {
            final List<Map<String, Object>> data = biz.tuijian();
            Result result = new Result(1,"今日推荐",data);
            String json = new Gson().toJson(result);
            response.getWriter().append(json);
        } catch (BizException e) {
            e.printStackTrace();
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
